package com.janko.springbootbase.controller.serialize;

import com.janko.springbootbase.controller.serialize.dto.Person;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * @Author nyk
 * @Date 2021/3/26 11:09
 * @Version 1.0
 * @Desc
 */
public class SerialTest {
    public static void main(String[] args) throws IOException {
        Person person=new Person(0,"张三","166********");
        System.out.println(person.toString());

        // 开始序列化
        ObjectOutputStream  objectInputStream=new ObjectOutputStream(new FileOutputStream("template"));
        objectInputStream.writeObject(person);
        objectInputStream.close();

    }
}
